// -----------------------------------------------
// Author:     code34 nicolas_boiteux@yahoo.fr
// Edited by:  Neumatic
// Warcontext: Enum factions
// -----------------------------------------------

private ["_classlist","_count","_actual","_side","_scope","_class","_vehicleclass","_faction","_factions","_sidetoget","_sidenum","_i"];

_sidetoget = _this select 0;

switch (_sidetoget) do {
	case east: {       _sidenum = 0 };
	case west: {       _sidenum = 1 };
	case resistance: { _sidenum = 2 };
	case civilian: {   _sidenum = 3 };
};

_classlist = [];
_factions = [];

_classlist = [];
_count = count (configFile >> "CfgVehicles");
for [{_i = 0}, {_i < _count}, {_i = _i + 1}] do {
	_actual = (configFile >> "CfgVehicles") select _i;
	if (isClass _actual) then {
		_class = configName _actual;
		_vehicleclass = getText (configFile >> "CfgVehicles" >> _class >> "vehicleClass");
		if (_class isKindOf "Man") then {
			if !(_vehicleclass in ["Sounds","Mines"]) then {
				_scope = getNumber (_actual >> "scope");
				_side = getNumber (_actual >> "side");
				if (_scope == 2 && {_side == _sidenum}) then {
					_faction = getText (configFile >> "CfgVehicles" >> _class >> "faction");
					if !(_faction in _factions) then {_factions = _factions + [_faction]};
					_classlist = _classlist + [[_faction, _class]];
				};
			};
		};
	};
};

[_factions, _classlist];